Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sass

Package Overview
Dependencies
Maintainers
3
Versions
273
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sass

A pure JavaScript implementation of Sass.

  • 1.81.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15M
increased by1.47%
Maintainers
3
Weekly downloads
 
Created

What is sass?

The sass npm package is a preprocessor scripting language that is interpreted or compiled into Cascading Style Sheets (CSS). It enables developers to use variables, nested rules, mixins, functions, and more, which can help in writing CSS in a more structured and maintainable way.

What are sass's main functionalities?

Variables

Variables allow you to store values that you can reuse throughout your stylesheet.

$primary-color: #333;

body {
  color: $primary-color;
}

Nesting

Nesting enables you to nest your CSS selectors in a way that follows the same visual hierarchy of your HTML.

nav {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li { display: inline-block; }

  a {
    display: block;
    padding: 6px 12px;
    text-decoration: none;
  }
}

Partials and Import

Partials are Sass files named with a leading underscore. You can import these partials into other Sass files to modularize your CSS and help keep things easier to maintain.

// _reset.scss
html,
body,
ul,
ol {
  margin: 0;
  padding: 0;
}

// main.scss
@import 'reset';
body {
  font-family: sans-serif;
}

Mixins

Mixins allow you to define styles that can be reused throughout your stylesheet.

@mixin border-radius($radius) {
  -webkit-border-radius: $radius;
     -moz-border-radius: $radius;
      -ms-border-radius: $radius;
          border-radius: $radius;
}

.box { @include border-radius(10px); }

Extend/Inheritance

Extend/Inheritance lets you share a set of CSS properties from one selector to another.

.message {
  border: 1px solid #ccc;
  padding: 10px;
  color: #333;
}

.success {
  @extend .message;
  border-color: green;
}

Operators

Sass supports standard math operators like +, -, *, /, and %.

.container {
  width: 100%;
}
.article {
  width: 600px / 960px * 100%;
}

Other packages similar to sass

Keywords

FAQs

Package last updated on 15 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc